%function Plot
clc;
clear all;
file = '/Users/yaowp/Desktop/hw3_ywp/result'

% %------------------------------------------------------------------------------
% % movie 
% set(gcf,'menubar','none','toolbar','none');
% mov = avifile('1.avi');
% mov.quality = 100;
% mov.compression='None';

%------------------------------------------------------------------------------
% set
Add_step =100
Max_step = 2000;
Dt = 0.001563;
N = 512;
step =0;
%------------------------------------------------------------------------------

PI = 3.14159265358979323846;
h = 2.0*PI/(N-1);
T =0;
x = 0:h:2*PI;
y = x;
%[X,Y] = meshgrid(x,y);
k = 0;

%colormap(hsv);
%'hsv','hot','cool','spring','gray'

while step <= Max_step
    matrix = load(sprintf([file,'/Rho_%d.dat'],step));
    for j = 1:1:N
        for i = 1:1:N
            k = (j-1)*N+i;
            rho(i,j) = matrix(k,1);
        end 
    end
    figure('visible','off');
    %imagesc(flipud(rho)); ew  
    imagesc(rho);  
    set(gca,'FontName','Arial','FontSize',36);
    %contourf(x,y,rho,10);
    colorbar;
    colormap(jet);
    T = step*Dt;
    title(sprintf('t = %f',T));
    xlabel('x');
    ylabel('y');
%     hold on;
    saveas(gcf,[file,'/rho_',num2str(step),'.png']);
    step = step+Add_step
%     F = getframe(gcf);
%     mov = addframe(mov,F);
%     pause(0.001);  
end
% mov = close(mov);

